import time

from common.base import Base
from common.base import open_browser
url = "http://ecshop.itsoso.cn/index.php"
class BuyPage(Base):
    # 制作定位器
    sy_loc = ("link text","首页") # 首页
    goods_loc = ("css selector","body>div.index-body>div>div>div:nth-child(2)>div.goods-right>div>a:nth-child(2)>div.img-box>img")
    number_loc = ("id","number")  # 购买数量输入框
    submit_loc = ("css selector","img[src='themes/default/images/buybtn1.png']") # 立即购买按钮
    def click_sy(self):
        # 点击首页
        self.click(self.sy_loc)
    def click_goods(self):
        # 点击商品
        self.click(self.goods_loc)
    def input_number(self,text):
        # 购买数量输入
        self.send_keys(self.number_loc,text)
    def click_submit(self):
        # 点击立即购买按钮
        self.click(self.submit_loc)

